﻿using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Linq;
using System.Text;
using System.Windows.Forms;
using System.Data.SqlClient;

namespace Xk
{
    public partial class frmMyResult : Form
    {
        public frmMyResult()
        {
            InitializeComponent();
        }

        private void getStuCou()
        {
            SqlConnection cn = new SqlConnection(Properties.Settings.Default.XkConnectionString);
            string sql = "SELECT StuCou.*, CouName FROM StuCou, Course";
            sql += " WHERE StuNo=@StuNo AND StuCou.CouNo=Course.CouNo";
            sql += " ORDER BY WillOrder";
            SqlDataAdapter da = new SqlDataAdapter(sql, cn);
            da.SelectCommand.Parameters.Add("StuNo", SqlDbType.NVarChar, 8).Value = CPublic.LoginInfo["StuNo"];
            DataSet ds = new DataSet();
            da.Fill(ds, "StuCou");
            dataGridView1.DataSource = ds.Tables["StuCou"];
        }

        private void frmMyResult_Load(object sender, EventArgs e)
        {
            dataGridView1.AutoGenerateColumns = false;
            getStuCou();
        }
    }
}
